package com.matrix.java.chap_05;


/*
    计算PI
 */
public class Ex5_25 {
    public static void main(String[] args) {
        double PI = 0;
        double a = 0;
        int num = 100000;
        for (int i = 1; i < num; i++) {
            a += Math.pow(-1, i + 1) / ((2 * i) - 1);
            PI = 4 * a;
            if (i % 10000 == 0) {
                System.out.println(PI);
            }
        }
    }
}
